//
//  WeakReference.swift
//  weile
//
//  Created by LKM on 16/10/5.
//  Copyright © 2016年 LKM. All rights reserved.
//
//copy ：http://stackoverflow.com/questions/24127587/how-do-i-declare-an-array-of-weak-references-in-swift
import UIKit

class WeakReference<T: AnyObject>  {

    weak var value : T?
    init (_ value: T) {
        self.value = value
    }
}
extension Array where Element:WeakReference<AnyObject> {
    mutating func reap () {
        self = self.filter { nil != $0.value }
    }
}
